home *** CD-ROM | disk | FTP | other *** search
- #ifndef _SLIST2_H_
- #define _SLIST2_H_
-
- #include <list>
-
- #define TRAVERSE(list, i) \
- for(i = (list).begin(); i != (list).end(); i++)
-
- template<class T>
- class extended_list : public std::list<T> {
- public:
- void clear(void) {
- erase(begin(), end());
- }
- bool delete_one(T* target)
- {
- bool flag = false;
- iterator i;
- TRAVERSE(*this, i) {
- if(&*i == target) {
- flag = true;
- iterator current_i = i--;
- erase(current_i);
- }
- }
- return flag;
- }
- };
-
- #endif /* _SLIST2_H_ */
-